$(function () {

    $('.nav-wrap .first-navli').on('click', function (e) {
        e.preventDefault();
        var that = $(this).next('ul.second-nav');
        that.css('display') === 'block' ? that.css({'display': 'none'}) : that.css({'display': 'block'});
        $('.nav-wrap ul.second-nav').not(that).css({'display': 'none'});
        $('.nav-wrap ul.second-nav').not(that).siblings('.nav-menu').children('.iconfont').removeClass('icon-downarrow').addClass('icon-rtarrow');

        if (that.css('display') === 'block') {
            $(this).children('.iconfont').addClass('icon-downarrow').removeClass('icon-rtarrow');
        } else if (that.css('display') === 'none') {
            $(this).children('.iconfont').addClass('icon-rtarrow').removeClass('icon-downarrow');
        }

    });

    $('.second-nav').find('li:has(ul)').children('a').append('<i class="iconfont icon-rtarrow second-arrow"></i>');


    $('.nav-wrap .second-navli').on('click', function (e) {
        e.preventDefault();
        var that = $(this).next('ul.third-nav');
        that.css('display') === 'block' ? that.css({'display': 'none'}) : that.css({'display': 'block'});
        $('.nav-wrap ul.third-nav').not(that).css({'display': 'none'});
        $('.nav-wrap ul.third-nav').not(that).siblings('.nav-menu').children('.iconfont').removeClass('icon-downarrow').addClass('icon-rtarrow');

        if (that.css('display') === 'block') {
            $(this).children('.iconfont').addClass('icon-downarrow').removeClass('icon-rtarrow');
        } else if (that.css('display') === 'none') {
            $(this).children('.iconfont').addClass('icon-rtarrow').removeClass('icon-downarrow');
        }

    });

    $('.nav-menu-box').mouseenter(function () {
        $(this).siblings('.nav-menu-box').children('.nav-menu-aside,.nav-img').removeClass('hover');
        $(this).children('.nav-menu-aside,.nav-img').addClass('hover');
    });
    $('.nav-img.hover,.nav-menu-box').mouseleave(function () {
        $('.nav-menu-aside,.nav-img').removeClass('hover');
        $(this).removeClass('hover');
    });
    //弹出框菜单
    $('.nav-wrap .first-menu').on('click', function (e) {
        e.preventDefault();
        var that = $(this).next('ul.second-menu');
        that.css('display') === 'block' ? that.css({'display': 'none'}) : that.css({'display': 'block'});
        $('.nav-wrap ul.second-menu').not(that).css({'display': 'none'});
    });
});



